Why Installed OSLC service do not delete objects?

Hi,

I created OSLC DXL service and installed it on my Doors Server. Following the guide:

https://www-01.ibm.com/support/knowledgecenter/SSYQBZ_9.6.0/com.ibm.doors.install.doc/topics/r_dxl_services.html

 

In my Java code I authenticate successfully and call the service to delete a particular object. I can not show the whole code but will post small part:

deleteObject("/path/module", 593)

void deleteObject(string modPath, int id) {

noError()
    Module mod = edit(modPath)
    deleteObject(mod, id, false)
    close(mod)
    string ErrMessage = lastError()
    if    (!null ErrMessage) {
             printMessage (1, "A run-time error occured: " quote(ErrMessage) "\n")
             setDxlServiceResult "Object with id: " (quote(id "")) "can not be deleted. During deletion process the followinf error appears:" ErrMessage
             error "Object with id: " (quote(id "")) "can not be deleted. During deletion process the followinf error appears:" ErrMessage
        } else {
            setDxlServiceResult "Successfully delete requirement with id:" id "" 
            printMessage (3, "The deletion of requirement was successfully. \n")
        }
}

void deleteObject(Module mod, int id, bool isSoftDeletion){

 

...

if(leaf(o2BDeleted)) {
        printMessage (3, "Check for descendents - id:" (quote(id ""))"\n")
        if (isSoftDeletion) {
               softDelete(o2BDeleted)
           } elseif (isDeleted(o2BDeleted)) {
                purgeObject_ (o2BDeleted)
        } else {
            printMessage (3, "Executing hard deleting on object id:" (quote(o2BDeleted."Absolute Number" ""))"\n")
            hardDelete(o2BDeleted) 
        }

 flushDeletions()

Where o2BDeleted is the object which we want to delete find by the id. 

And from the log I see that I enter in the hardDelete case.

 

DEBUG: Try to delete object with id:"593"
DEBUG: Check for descendents - id:"593"
DEBUG: Executing hard deleting on object id:"593"
DEBUG: The deletion of requirement was successfully.

And in my Java code which call the service I get:

Successfully delete requirement with id:" 593 "

BUT the 593 is not actually deleted is still there. From where the error can come from? I check for error while deletion there is no errors - ErrMessage is not null.

Locally this code works fine. There is something DXL strange when we do it on a service? Something different than refreshDeletion() ?? Any ideas?

 

 

 


Dinio - Wed Jan 20 08:32:14 EST 2016

Re: Why Installed OSLC service do not delete objects?
Dinio - Wed Jan 20 09:21:07 EST 2016

The problem was that it was not saved before close(). Just have to add:

save(mod)

close(mod)

Re: Why Installed OSLC service do not delete objects?
Mike.Scharnow - Wed Jan 20 10:06:01 EST 2016

Dinio - Wed Jan 20 09:21:07 EST 2016

The problem was that it was not saved before close(). Just have to add:

save(mod)

close(mod)

and you should save the error message in another variable.

otherwise it might happen that save or close produce a new lastError() and the original error of not being able to delete will disappear.

You also might want to catch an error that occurs when opening the module

Re: Why Installed OSLC service do not delete objects?
Dinio - Thu Jan 21 03:47:15 EST 2016

Mike.Scharnow - Wed Jan 20 10:06:01 EST 2016

and you should save the error message in another variable.

otherwise it might happen that save or close produce a new lastError() and the original error of not being able to delete will disappear.

You also might want to catch an error that occurs when opening the module

OK, But strange things happens. When have error for example want to delete object it with no existing id, I see error "Not valid Id" and despite of noerror()-lastError() my service said dxlServiceResult: uninitialised?

Do I have to write  insted of error "message" directlly

setDxlServiceResult "messsage"